﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace QBZ.Evaluation.Models
{
    public class UserModel: UserBaseModel
    {
        [Required]
        [DataType(DataType.Password)]
        public string UserPassword { get; set; }
        public bool IsDelete { get; set; }
        public DateTime? CreateOn { get; set; }
        public int? CreateBy { get; set; }
        public DateTime? UpdateOn { get; set; }
        public int? UpdateBy { get; set; }
        public byte[] TimeStamp { get; set; }
        public Guid? Guid { get; set; }
    }

    public class UserInfo
    {
        public UserBaseModel BaseInfo { get; set; }
        public List<MenuModel> Menu { get; set; }
        public string[] UserLevels { get; set; }
        public List<RoleModel> Role { get; set; }

        public UserInfo()
        {
            Menu = new List<MenuModel>();
            UserLevels = new string[] { "NoLogin", "RegUser", "AuthUser", "Admin", "SuperAdmin" };
        }
    }

    public class MenuModel
    {
        public string Title { get; set; }
        public string Icon { get; set; }
        public string Link { get; set; }
        public List<MenuModel> ChildMenu { get; set; }
    }


    public class UserBaseModel
    {
        public int UserId { get; set; }
        [Required]
        public string UserName { get; set; }
        public string UserNick { get; set; }
        public UserLevel UserLevel { get; set; }
        public string UserEmail { get; set; }
        public string UserPhone { get; set; }
        public int? RoleChildId { get; set; }
    }

    public class UserRoleModel:UserBaseModel
    {
        public int RoleId { get; set; }
        //public int RoleChildId { get; set; }
        public string RoleName { get; set; }
        public string RoleChildName { get; set; }
    }

    public enum UserLevel
    {
        NoLogin = 0,
        RegUser = 1,
        AuthUser = 2,
        Admin = 3,
        SuperAdmin = 4
    }

    public enum OAuthWay
    {
        QQ =1,
        Wechat = 2,
        Weibo = 3

    }

    public class OAuthModel
    {
        public int OAuthId { get; set; }
        public string OpenId { get; set; }
        public OAuthWay OAuthWay { get; set; }
        public int UserId { get; set; }
        public UserLevel UserLevel { get; set; }
        public string Token { get; set; }
        public string NickName { get; set; }
        public string Sex { get; set; }
        public string Country { get; set; }
        public string Province { get; set; }
        public string City { get; set; }
        public string BirthDay { get; set; }
        public string FigureUrl { get; set; }
        public string Language { get; set; }
        public string UnionId { get; set; }
    }

    public class SetUserLevelModel
    {
        public int UserId { get; set; }
        public string UserLevel { get; set; }
    }

}
